package IOStream;

import java.io.*;

/*
    字符读取流(输入流)
 */
public class ReaderDemo {
    public static void main(String[] args) {
        File file=new File("C:\\IOStream\\read.txt");
        FileReader fr=null;
        BufferedReader br=null;
        try {
            fr=new FileReader(file);     //创建字符输入流
            br=new BufferedReader(fr);       //创建字符输入缓冲流
            String str;
            while ((str=br.readLine())!=null){
                System.out.println(str);
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                fr.close();
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
